﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace QLHD.Controls.QLHD
{
    public partial class Edit : System.Web.UI.UserControl
    {
        public int Role = 0;
        protected string strButton = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {

            if (HttpContext.Current.Session["Role"] != null)
            {
                Role = HttpContext.Current.Session["Role"].ChangeType<Int32>();
                StringBuilder sb = new StringBuilder();
                if(Role == 1) // user
                {
                    sb.Append("<button class=\"btn btn-info btnSua\" onclick=\"QLHD.Actions.HuyHopDong('edit',0)\" type=\"button\">Sửa</button>");
                }
                else // admin
                {
                    sb.Append("<button class=\"btn btn-info btnSua\" onclick=\"QLHD.Actions.HuyHopDong('edit',0)\" type=\"button\">Sửa</button>&nbsp;");
                    sb.Append("<button class=\"btn btn-primary btnThaydoi\" type=\"button\"  onclick=\"QLHD.Actions.HuyHopDong('edit',2)\">Thay đổi</button>&nbsp;");
                    sb.Append("<button class=\"btn btn-danger btnHuyHopDong\" type=\"button\"  onclick=\"QLHD.Actions.HuyHopDong('delete')\">Hủy HĐ</button>");
                }
               
                //<%--<button class="btn btn-default btnNhuongHopDong" type="button">Nhượng lại HĐ</button>--%>
                sb.Append("<button style=\"display:none\" class=\"btn btn-primary btnLuuHopDong\" onclick=\"QLHD.Actions.LuuHopDong()\" type=\"button\">Lưu</button>&nbsp;");
                sb.Append("<button style=\"display:none\" class=\"btn btn-danger btnReturn\" type=\"button\" onclick=\"window.location.href='/List.aspx?pID=1'\">Hủy</button>&nbsp;");
                sb.Append("<button style=\"display:none\" class=\"btn btn-danger btnCancel\" type=\"button\" onclick=\"QLHD.Actions.HuyHopDong('disable',1)\">Hủy</button>");

                strButton = sb.ToString();
            }

        }
    }
}